﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Win32;
namespace JustMoveIt.Logic
{
    class RegistryHelper
    {
        public static void CreateRegistry(string appPath)
        {
            try
            {
                RegistryKey tagKey = Registry.CurrentUser.CreateSubKey(@"Software\Classes\*\shell\JustMoveIt");
                tagKey.SetValue(null, "Just Move It!");
            }
            catch
            {
            }

            try
            {
                RegistryKey tagKeyCommand =
                    Registry.CurrentUser.CreateSubKey(@"Software\Classes\*\shell\JustMoveIt\command");
                tagKeyCommand.SetValue(null, appPath + " -JMI %1");
            }
            catch
            {
            }
            try
            {
                RegistryKey tagKey = Registry.CurrentUser.CreateSubKey(@"Software\Classes\Folder\shell\JustMoveIt");
                tagKey.SetValue(null, "Just Move It!");
            }
            catch
            {
            }

            try
            {
                RegistryKey tagKeyCommand =
                    Registry.CurrentUser.CreateSubKey(@"Software\Classes\Folder\shell\JustMoveIt\command");
                tagKeyCommand.SetValue(null, appPath + " -JMI %1");
            }
            catch
            {
            }
        }


        public static void RemoveRegistry()
        {
            try
            {
                Registry.CurrentUser.DeleteSubKeyTree(@"Software\Classes\*\shell\JustMoveIt");
            }
            catch { }
            try
            {
                Registry.CurrentUser.DeleteSubKeyTree(@"Software\Classes\Folder\shell\JustMoveIt");
            }
            catch
            {
            }
        }
    }
}
